<?php
namespace app\admin\model;

use think\Model;
use think\Db;

class Admin extends Model
{
    // 登陆
    public function login($admin_username,$admin_password){
        $res = DB::name('admin')
            ->where("username='$admin_username' and password='$admin_password'")
            ->find();
        if($res){
            session('admin.admin_id',$res['id']);
            session('admin.admin_username',$res['username']);
            return "1";
        }else{
            return "2";
        }
    }
}